@extends('Admin.Index.index')
@section('title')
    商品属性列表
@endsection

@section('content')

    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span> 用户管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="pd-20">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <a href="{{url('/property_add/')}}" onclick="user_add('550','','添加用户','')" class="btn btn-primary radius"><i class="icon-plus"></i> 添加属性</a></span>
            <span class="r">共有数据：<strong>{{$count}}</strong> 条</span>
        </div>
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th>ID</th>
                <th>商品类别</th>
                <th>属性名称</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($data as $re)
                <tr class="text-c">
                    <td>{{$re->p_id}}</td>
                    <td>{{$re->c_name}}</td>
                    <td>{{$re->p_name}}</td>
                    <td>
                        <a title="添加属性值" href="{{action('Admin\PropertyController@property_value_add',['p_id'=>$re->p_id])}}" style="text-decoration:none"><i class="Hui-iconfont">&#xe610;</i></a>
                        <a title="属性值列表" href="{{action('Admin\PropertyController@property_value_list',['p_id'=>$re->p_id])}}" style="text-decoration:none"><i class="Hui-iconfont">&#xe6c6;</i></a>
                        <a title="修改属性"   href="{{action('Admin\PropertyController@property_update',['p_id'=>$re->p_id,'c_id'=>$re->c_id])}}" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                        {{--<a id="property_delete" href="{{action('PropertyController@property_delete',['p_id'=>$re->p_id])}}" class="Hui-iconfont">&#xe609;</a>--}}
                        <a title="删除属性" onclick="class_del(this,'{{$re->p_id}}')" class="Hui-iconfont">&#xe609;</a>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
        <div id="pageNav" class="pageNav"></div>
    </div>

    <script type="text/javascript">
        function class_del(obj,p_id) {
            layer.confirm('确认要删除吗？', function (index) {
                $.ajax({
                    type: 'POST',
                    url: '/property_delete/'+p_id,
                    dataType: 'json',
                    success: function (e) {
                        if (e.status) {
                            $(obj).parents("tr").remove();
                            layer.msg('已删除!', {icon: 1, time: 1000});
                        }else {
                            layer.msg(e.info);
                        }
                    }
                });
            });
        }
    </script>
@endsection